package com.webService;

import java.util.HashMap;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;

public class Test2 {
	public static void main(String[] args) {
		String url = "http://localhost:8080/UserService?wsdl";
	    JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
	    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();    // 策略
	    httpClientPolicy.setConnectionTimeout( 36000 );    //连接超时 
	    httpClientPolicy.setAllowChunking( false );   
	    httpClientPolicy.setReceiveTimeout( 10000 );       //接收超时
	    Client client = dcf.createClient(url);
	    HTTPConduit http = (HTTPConduit) client.getConduit();  
	    http.setClient(httpClientPolicy);
	    
	    
	    try {
	    	Object[] objects = client.invoke("getUser", "411001");
			System.out.println(objects[0]);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
